package com.learn.hibernatevalidator.chapter07.valueextractor.valueextractor;

import com.google.common.collect.Multimap;
import jakarta.validation.valueextraction.ExtractedValue;
import jakarta.validation.valueextraction.ValueExtractor;

/**
 * @author: liyf
 * @create: 2025-01-18 23:13
 **/
public class MultimapKeyValueExtractor implements ValueExtractor<Multimap<@ExtractedValue ?, ?>> {

    @Override
    public void extractValues(Multimap<?, ?> originalValue, ValueReceiver receiver) {
        for (Object key : originalValue.keySet()) {
            receiver.keyedValue("<multimap key>", key, key);
        }
    }
}